package com.linkhouse.domain.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.util.Date;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@Document(indexName = "old_room")
public class TbOldRoom implements Serializable {//二手房源表
    @TableId(type = IdType.AUTO)//主键自增
    @Id
    private Long id;
    /**
     * 房源图片
     */
    @Field(name = "room_image",type = FieldType.Keyword, index = false)
    private String roomImage;
    /**
     * 房源描述
     */
    @Field(name = "room_description",type = FieldType.Keyword)
    private String roomDescription;
    /**
     * 房源首付价
     */
    @Field(name = "room_first_pay",type = FieldType.Double)
    private Long roomFirstPay;
    /**
     * 房源单价
     */
    @Field(name = "room_price",type = FieldType.Double)
    private Long roomPrice;
    /**
     * 房源规格
     */
    @Field(name = "room_specs",type = FieldType.Keyword)
    private String roomSpecs;
    /**
     * 房源地址
     * 更具地址分词查找
     */
    @Field(name = "room_addr",type = FieldType.Text, analyzer = "ik_max_word")
    private String roomAddr;
    /**
     * 房源介绍
     */
    @Field(name = "room_introduce",type = FieldType.Keyword)
    private String roomIntroduce;
    /**
     * 房源经纬度
     */
    @Field(name = "room_longitude",type = FieldType.Keyword)
    private String roomLongitude;
    /**
     * 房源上传者
     */
    @Field(name = "user_id",type = FieldType.Long)
    private Long userId;
    /**
     * 房源上传时间
     */
    @Field(name = "uploading_time",type = FieldType.Date,format = DateFormat.date_time, pattern ="YYYY-MM-DD HH:mm:ss.sssZ")
    @JsonFormat(pattern ="yyyy-MM-dd HH:mm:ss", timezone ="GMT+8")// 数据格式转换，并加上8⼩时进⾏存储
    private Date uploadingTime;
    /**
     * 房源修改时间
     */
    @Field(name = "update_time",type = FieldType.Date,format = DateFormat.date_time, pattern ="YYYY-MM-DD HH:mm:ss.sssZ")
    @JsonFormat(pattern ="yyyy-MM-dd HH:mm:ss", timezone ="GMT+8")// 数据格式转换，并加上8⼩时进⾏存储
    private Date updateTime;
    /**
     * 逻辑删除
     */
    @Field(name = "is_delete",type = FieldType.Integer)
    private Integer isDelete;
    /**
     * 房源楼层
     */
    @Field(name = "floor",type = FieldType.Keyword)
    private String floor;
    /**
     * 房源朝向,1.南,2.北,3东,4西
     */
    @Field(name = "orientation",type = FieldType.Keyword)
    private String orientation;
    /**
     * 房源装修,0.简修,1.精修2.毛坯
     */
    @Field(name = "finish",type = FieldType.Keyword)
    private String finish;
    /**
     * 房源年代
     */
    @Field(name = "times",type = FieldType.Keyword)
    private String times;
    /**
     * 房源预算
     */
    @Field(name = "budget",type = FieldType.Long)
    private Long budget;
    /**
     * 房源评分
     */
    @Field(name = "score",type = FieldType.Integer)
    private Integer score;
    /**
     * 审核状态
     *  0:未审核  1：审核通过  2：审核不通过
     */
    @Field(name = "audit_status",type = FieldType.Integer)
    private Integer auditStatus;
}
